#ifndef MLGESTURE_H
#define MLGESTURE_H

#include "mlgesture_global.h"

/*
 * Pliki nagłówkowe biblioteki
 */
#include "handgestureexception.h"
#include "trajectory.h"
#include "gestureobserver.h"

#include <vector>
#include <cv.h>

using namespace cv;
using namespace std;

namespace mlgesture {

class Control;

class MLGESTURESHARED_EXPORT MLGesture {
public:
	MLGesture(int video_id = -1, int hands_num = 1) throw(HandGestureException);
	~MLGesture();

	void startProcess();
	void stopProcess();
	bool getFrame(Mat& frame) const;
	void getMask(Mat &mask) const;
	Size getFrameSize() const;
	void setHandsNum(const int num);
	void adjustSkinFilter(const int lower_threshold, const int upper_threshold,
						  const int lower_value_threshold, const int upper_value_threshold) throw (HandGestureException);
	void setAdaptiveAlgoritm(const bool adapt);
	void adjustTrackingSensity(const double sensity) throw (HandGestureException);
	void getTrackShapeMask(vector<Mat>& shapes) const throw (HandGestureException);
	void releaseCamera();

	void enableTrajectory(bool enable);
	void enableDynamicGesture(bool enable) throw (HandGestureException);
	void enableStaticGesture(bool enable);

	const vector<Trajectory>& getTrajectory(vector<bool>& trajectory_status, vector<bool>& trajectory_end) const throw (HandGestureException);
	const vector<int>& getLastDirection() const throw (HandGestureException);
	const vector<Point>& getLastPos() const throw (HandGestureException);

	void loadDynamicGestureModels(const vector<QString> &model_files, const QString &garbage_file) throw (HandGestureException);
	void loadStaticGesturesModels(const QString &model_file, const QString &scale_factors_file, const QString &labels_file) throw (HandGestureException);

	static void addObserver(GestureObserver* observer);
	static void removeObserver(GestureObserver* observer);

	static int getGlobalLowThreshold();
	static int getGlobalUpperThreshold();
	static int getGlobalValueLowThreshold();
	static int getGlobalValueUpperThreshold();

private:
	Control *control_;
};

}

#endif // MLGESTURE_H
